package com.fgr.mapper;

import com.fgr.beans.Admin;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface AdminMapper {

    @Select("select * from an_admin")
    public List<Admin> allAdmin();

    @Select("select * from an_admin where gl_id=#{glId}")
    public Admin findAdminById(Integer glId);

    @Select("select * from an_admin where gl_username=#{glUsername}")
    public Admin findAdminByUsername(String glUsername);

    @Select("select * from an_admin where gl_username=#{glUsername} and gl_password=#{glPassword}")
    public Admin AdminLogin(Admin admin);

    @Insert("insert into an_admin(gl_username,gl_password) value(#{glUsername},#{glPassword})")
    public Integer AddAdmin(Admin admin);

    @Update("update an_admin set gl_username=#{glUsername},gl_password=#{glPassword} where gl_id=#{glId}")
    public Integer UpdateAdmin(Admin admin);

    @Delete("delete from an_admin where gl_id=#{glId}")
    public Integer DeleteAdmin(Integer glId);


}
